package cn.rkylin.oms.ext.cainiao.stockin.vo;

import java.math.BigDecimal;
import java.util.List;

import cn.rkylin.oms.common.consts.StockInStatus;
import cn.rkylin.oms.ext.cainiao.stockin.domain.StockIn;

/**
 * 入库VO
 * 
 * @author 齐涛
 * @version 1.0
 * @created 11-9-2017 10:51:30
 */
public class StockInVO extends StockIn {

    private static final String STATUS_SKUSHOW = "<span class=\"sku-show fa fa-chevron-down\" stockinId=\"%s\"></span>";
    private static final String OPERATION_BTN_AUDIT = "<button onclick=\"operationAudit(this)\" stockinId=\"%s\" type=\"button\" class=\"btn btn-warning btn-xs\" pepid='stockinAuthen'><i class=\"fa fa-check\"></i>&nbsp;审核</button>";
    private static final String OPERATION_BTN_EDIT = "<button onclick=\"operationEdit(this)\" stockinId=\"%s\" type=\"button\" class=\"btn btn-info btn-xs\" pepid='stockinEdit'><i class=\"fa fa-edit\"></i>&nbsp;修改</button>";
    private static final String OPERATION_BTN_DEL = "<button onclick=\"operationDel(this)\" stockinId=\"%s\" stockInStatus=\"%s\" type=\"button\" class=\"btn btn-danger btn-xs\" pepid='stockinDelete'><i class=\"fa fa-trash-o\"></i>&nbsp;删除</button>";
    private static final String OPERATION_BTN_UPDATE_REMARK = "<button onclick=\"operationUpdateRemark(this)\" stockinId=\"%s\" type=\"button\" class=\"btn btn-info btn-xs\" pepid='stockinRemark'><i class=\"fa fa-edit\"></i>&nbsp;备注</button>";

    // 基本查询条件
    private String quickSearch;

    // 高级查询条件
    // 计划入库时间开始
    private String planInTimeStart;

    // 计划入库时间结束
    private String planInTimeEnd;

    // 实际入库时间开始
    private String factInTimeStart;

    // 实际入库时间结束
    private String factInTimeEnd;

    // 审核时间开始
    private String apprTimeStart;

    // 审核时间结束
    private String apprTimeEnd;

    // 商品编码
    private String goodsCode;

    // 商品名称
    private String goodsName;

    // 规格编码
    private String skuCode;

    // 规格名称
    private String skuName;

    // 排序
    private String orderBy;

    // TAB入库状态
    private String tabStockInStatus;

    // 入库商品信息展开按钮扩展
    private String skuShow;

    // 入库金额
    private BigDecimal purcAmount;

    // 操作按钮
    private String operation;

    // 更新信息
    // 入库商品VO LIST
    private List<StockInGoodsVO> stockInGoodsVOList;

    public String getQuickSearch() {
        return quickSearch;
    }

    public void setQuickSearch(String quickSearch) {
        this.quickSearch = quickSearch;
    }

    public String getPlanInTimeStart() {
        return planInTimeStart;
    }

    public void setPlanInTimeStart(String planInTimeStart) {
        this.planInTimeStart = planInTimeStart;
    }

    public String getPlanInTimeEnd() {
        return planInTimeEnd;
    }

    public void setPlanInTimeEnd(String planInTimeEnd) {
        this.planInTimeEnd = planInTimeEnd;
    }

    public String getFactInTimeStart() {
        return factInTimeStart;
    }

    public void setFactInTimeStart(String factInTimeStart) {
        this.factInTimeStart = factInTimeStart;
    }

    public String getFactInTimeEnd() {
        return factInTimeEnd;
    }

    public void setFactInTimeEnd(String factInTimeEnd) {
        this.factInTimeEnd = factInTimeEnd;
    }

    public String getApprTimeStart() {
        return apprTimeStart;
    }

    public void setApprTimeStart(String apprTimeStart) {
        this.apprTimeStart = apprTimeStart;
    }

    public String getApprTimeEnd() {
        return apprTimeEnd;
    }

    public void setApprTimeEnd(String apprTimeEnd) {
        this.apprTimeEnd = apprTimeEnd;
    }

    public String getGoodsCode() {
        return goodsCode;
    }

    public void setGoodsCode(String goodsCode) {
        this.goodsCode = goodsCode;
    }

    public String getGoodsName() {
        return goodsName;
    }

    public void setGoodsName(String goodsName) {
        this.goodsName = goodsName;
    }

    public String getSkuCode() {
        return skuCode;
    }

    public void setSkuCode(String skuCode) {
        this.skuCode = skuCode;
    }

    public String getSkuName() {
        return skuName;
    }

    public void setSkuName(String skuName) {
        this.skuName = skuName;
    }

    public String getOrderBy() {
        return orderBy;
    }

    public void setOrderBy(String orderBy) {
        this.orderBy = orderBy;
    }

    public String getTabStockInStatus() {
        return tabStockInStatus;
    }

    public void setTabStockInStatus(String tabStockInStatus) {
        this.tabStockInStatus = tabStockInStatus;
    }

    public String getSkuShow() {
        return String.format(STATUS_SKUSHOW, this.getStockinId()).toString();
    }

    public void setSkuShow(String skuShow) {
        this.skuShow = String.format(STATUS_SKUSHOW, "").toString();
    }

    public BigDecimal getPurcAmount() {
        return purcAmount;
    }

    public void setPurcAmount(BigDecimal purcAmount) {
        this.purcAmount = purcAmount;
    }

    public String getOperation() {
        StringBuffer opButton = new StringBuffer();
        if (StockInStatus.WAIT_AUDIT.equals(this.getTabStockInStatus())) {
            opButton.append(String.format(OPERATION_BTN_AUDIT, super.getStockinId()));
            opButton.append("&nbsp;");
            opButton.append(String.format(OPERATION_BTN_EDIT, super.getStockinId()));
            opButton.append("&nbsp;");
            opButton.append(String.format(OPERATION_BTN_DEL, super.getStockinId(), StockInStatus.WAIT_AUDIT));
        } else if (StockInStatus.WAIT_STOCKIN.equals(this.getTabStockInStatus())) {
            opButton.append(String.format(OPERATION_BTN_UPDATE_REMARK, super.getStockinId()));
            opButton.append("&nbsp;");
            opButton.append(String.format(OPERATION_BTN_DEL, super.getStockinId(), StockInStatus.WAIT_STOCKIN));
        } else if (StockInStatus.STOCKINING.equals(this.getTabStockInStatus())) {
            opButton.append(String.format(OPERATION_BTN_UPDATE_REMARK, super.getStockinId()));
        } else if (StockInStatus.STOCKINED.equals(this.getTabStockInStatus())) {
            opButton.append(String.format(OPERATION_BTN_UPDATE_REMARK, super.getStockinId()));
        }
        operation = opButton.toString();
        return operation;
    }

    public void setOperation(String operation) {
        this.operation = operation;
    }

    public List<StockInGoodsVO> getStockInGoodsVOList() {
        return stockInGoodsVOList;
    }

    public void setStockInGoodsVOList(List<StockInGoodsVO> stockInGoodsVOList) {
        this.stockInGoodsVOList = stockInGoodsVOList;
    }

}
